class Solution8 {
    public static void main(String[] args) {
        int[] arr = {3,0,8,2,0,0,1};
        System.out.println(canJump(arr));
    }
    public static boolean canJump(int[] nums) {
        int len = nums.length ;
        boolean[][] dp = new boolean[len+1][len+1] ;
        for(int i=0 ; i <= len ; i ++) {
            dp[0][i] = true ;
            dp[1][i] = true ;
        }
        for(int i=2 ; i<= len ; i ++){
            for(int j=1 ; j<= i ; j ++){
                if(nums[j-1]+j >= i && dp[j][j-1]){
                    dp[i][j] = true ;
                }
            }
        }
        boolean flg = false ;
         for(int i=0 ; i <= len ; i ++){
            flg |= dp[len][i];
         }

        return flg ;

    }
}